/*
 * CSS2 1.0
 * By Alexander Yegorov (http://slamer.ru)
 * Copyright (c) 2010 Alexander Yegorov
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
 *
 * Return integer value of any css property
*/
jQuery.fn.css2 = function(name) {
	var elem = jQuery(this);
	var text = elem.css(name);
	if (text.substr(0, text.indexOf('p')) != '') return Math.ceil(text.substr(0, text.indexOf('p')));
	else return operaMargins(this, name);
};

// Get margins, paddings for Opera
function operaMargins(elem, name) {
	var arrProperty = name.split('-');
	var side = arrProperty[1];
	var value = $(elem).css(arrProperty[0]);

	arrValue = value.replace(/px/gi, '').split(' '); // Make array with all values
	// Select require value for return
	if (side == 'top') return arrValue[0];
	if (side == 'right' && arrValue[1] == undefined) return arrValue[0];
	else if (side == 'right') return arrValue[1];
	if (side == 'bottom' && arrValue[2] == undefined) return arrValue[0];
	else if (side == 'bottom') return arrValue[2];
	if (arrValue[3] != undefined) return arrValue[3];
	if (arrValue[1] != undefined) return arrValue[1];
	return arrValue[0];
}